import {
    Request
} from './request.js'
import md5 from '../utils/md5'
// import request from './request'

// const request2 = new Request('https://cloudcode.51zidan.com', true, true)
const request2 = new Request('https://apis.map.qq.com', true, true)
// https://apis.map.qq.com/ws/geocoder/v1/?location=39.984154,116.307490&key=OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77&get_poi=1
/*
 * 通过坐标逆向获取位置信息
 */
export function amapRegeo(data) {
    console.log(data.location,'data.location')
    let SIG = md5('/ws/geocoder/v1/?key=DOHBZ-SPX3J-SQOFQ-XLIHQ-WSR2Z-BVB42&location=' + data.location + 'VK7O6fR92i5ODEtIschycfJR7smOrvCq')
    return request2
        .get('/ws/geocoder/v1/', {
            location: data.location,
            key: 'DOHBZ-SPX3J-SQOFQ-XLIHQ-WSR2Z-BVB42',
            sig: SIG
        }).then(res => {
            return res.data
        })
}